﻿using DDDSample.Domain.Location;
using NHibernate;

namespace DDDSample.Application.Repositories
{
    public static class Extensions
    {
        public static Location FindLocation(this ISession session, UnLocode locode)
        {
            const string query = @"from DDDSample.Domain.Location.Location l where l.UnLocode = :unLocode";
            return session.CreateQuery(query).SetString("unLocode", locode.CodeString)
               .UniqueResult<Location>();
        }
    }
}